package literary.fuwenhao.com.myapplication;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;


/**
 * A simple {@link Fragment} subclass.
 */
@ContentView(R.layout.fragment_sencond)
public class SencondFragment extends Fragment {

    @ViewInject(R.id.btn_2)
    Button button;
    View view;
    public SencondFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (null==view){
            view= x.view().inject(this,inflater,container);
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent=new Intent(getContext(),MainActivity.class);
                    intent.putExtra("type",2);
                    getActivity().startActivity(intent);
                }
            });
        }
        return view;
    }

}
